<%@ page import="cn.edu.lingnan.pojo.Student" %>
<%@ page import="java.util.List" %>
<%@ page language="java" isThreadSafe="true" pageEncoding="utf8" %>
<html lang="en">
<head>
    <title>修改学生信息</title>
    <!-- 引入Vue.js -->
    <script src="../../ststic/js/vue.js"></script>
    <!-- 引入样式 -->
    <link rel="stylesheet" href="../../ststic/js/element-ui/lib/theme-chalk/index.css">
    <!-- 引入组件库 -->
    <script src="../../ststic/js/element-ui/lib/index.js"></script>
<%--    <script src="../../ststic/js/main.js"></script>--%>
</head>
<body>
<div id="app">
    <el-container>
        <el-header>
            <el-header>
                <div style="float: right; font-size: 15px">
                    <el-dropdown>
                        <i class="el-icon-setting" style="margin-right: 10px"></i>
                        <el-dropdown-menu>
                            <el-dropdown-item><a href="/loginout" style="text-decoration: none">
                                退出</a></el-dropdown-item>
                        </el-dropdown-menu>
                    </el-dropdown>
                    <span>&nbsp</span>
                    ${sid}
                </div>
                <span>岭南师范学院计算机与智能教育学院社团管理系统</span>
            </el-header>
        </el-header>
        <el-container>
            <el-aside width="200px" style="background-color: rgb(238, 241, 246)">
                <el-menu :default-openeds="['1', '2']">
                    <el-submenu index="1">
                        <template slot="title"><i class="el-icon-edit-outline"></i>管理</template>
                        <el-menu-item index="1-1">
                            <i class="el-icon-user-solid"></i><el-link href="/student/queryAllStu">学生管理</el-link>
                        </el-menu-item>
                        <el-menu-item index="1-2">
                            <i class="el-icon-paperclip"></i><el-link href="/club/queryAllClub">职位管理</el-link>
                        </el-menu-item>
                        <el-menu-item index="1-3">
                            <i class="el-icon-suitcase"></i><el-link href="/position/queryAllPost">社团管理</el-link>
                        </el-menu-item>
                    </el-submenu>
                    <el-submenu index="2">
                    </el-submenu>
                </el-menu>
            </el-aside>
            <el-main>
                <form id="form" action="updateStu">
                    <table class="el-table">
                        <tr>
                            <td>学号</td>
                            <td>姓名</td>
                            <td>密码</td>
                            <td>权限</td>
                            <td>备注</td>
                            <td>操作</td>
                        </tr>
                        <%
                            List<Student> allStu = (List<Student>) session.getAttribute("allStu");
                            String sid = request.getParameter("sid");
                            for (Student student : allStu) {
                                if (student.getSid().equals(sid)) {
                        %>
                        <tr style="margin: auto;padding: 2px">
                            <td><%=student.getSid()%><input type="hidden" name="sid" value="<%=student.getSid()%>">
                            </td>
                            <td><input type="text" name="sname" value="<%=student.getSname()%>">
                            </td>
                            <td><input type="text" name="password" value="<%=student.getPassword()%>">
                            </td>
                            <td><input type="text" name="sright" value="<%=student.getSright()%>">
                            </td>
                            <td><input type="text" name="sflag" value="<%=student.getSflag()%>">
                            </td>
                            <td>
                                <el-link @click="submitForm" type="primary" style="margin: 10px">确认修改</el-link>
                                <el-link type="primary" onclick=window.location.href='/student/queryAllStu'>取消</el-link>
                            </td>
                        </tr>
                        <%
                                }
                            }
                        %>
                    </table>
                </form>
            </el-main>
        </el-container>
    </el-container>
</div>
</body>
<script>
    new Vue({
        el: "#app",
        data() {
            return{

            }
        },
        methods: {
            submitForm() {
                document.getElementById("form").submit();
            }
        }
    })
</script>
<style>
    .el-header {
        background-color: #B3C0D1;
        color: #333;
        text-align: center;
        line-height: 60px;
    }

    .el-aside {
        background-color: #D3DCE6;
        color: #333;
        text-align: center;
        line-height: 200px;
        width: 200px;

    }

    .el-main {
        background-color: #E9EEF3;
        color: #333;
        text-align: center;
        line-height: 160px;
    }

    body > .el-container {
        margin-bottom: 40px;
    }

    body {
        padding: 0;
        margin: 0;
    }
</style>
</html>